Docs

ARexxWebServer V2.0 (ARWS)
By Casey Halverson
Copyright 1996, 1997, and 1998, All Rights Reserved


DISCLAIMER:

This software is AS IS with no warranty implied.  If you some how format your
hard-drive or blow up your computer with this ARexx script, its not my fault.
You may change all you want, but when transfering this software archive, be
sure to keep it fully intact as the original.  Also, EMail me your latest and
greatest, since I would love to see what you have done.  If it is good, i will
include it as a sample in my next release.  Also, one last item, if you wish
to include this in a CD-ROM collection (becides Aminet), please notify me.
Also, I would love to hear if you have made use of this script.  

I think I have fixed the security problem.  By scanning for :'s and
double //'s, this should keep people from retrieving files they shouldn't be.
However, if this does not work out properly, I am still not responsible for
what happens.


INTRODUCTION:

Who needs a compiled program, when you can have much more fun in ARexx?  This
is a web server for those who wish to have more control over their web server. 
Another factor is size.  2,438 bytes is the size of version 2.0.  Also, I have
included my orignal web server I first wrote, which is a mere 453 bytes.  One
major point I would like to get across is simply there is no excuse for a
10 meg web server, or a 1 meg server, or even a 500k web server.  Web servers
should be small and compact.  And thanks to the Amiga and ARexx, this has
been made possible.  ARWS is not only a political statement, but also a very
useful tool as well.  I use my Amiga, ARexx, the Internet, and a server with
an ARWS "core" to control electronic devices at home, read and write my
email remotely, display my system status, run a message board, and even a
proxy server.  Hopefully maybe you can develop such innovations with the Amiga
and ARexx, or if not, take the time to enjoy what it can offer.  One interesting
note is this entire section (Introduction) is more then twice the size in bytes
of ARWS Version 1.0 ;-)


MAKING YOUR AMIGA KNOWN BY OBTAINING A FREE STATIC ADDRESS:

I urge you, if you wish to keep up your Amiga as an internet server, to 
obtain an ml.org address.  Visit their website at http://www.ml.org, and
download (one of the many) ml.org ip address updating programs availble on
aminet.  Ml.org allows you to issue your current IP address to their servers,
giving you a domain which points to your current address.  Such an address
would be either .ml.org or .dyn.ml.org.  I use
wot.dyn.ml.org and enjoy the service.  The best thing is that it is free,
but donations for supporting their cause is always welcome.  

There are also other pay services, however, I owe ml.org a bit of
advertisement for my long usage ;-)


INSTALLING:

Installation should be pretty automatic, but here is information if you
wish to do it manually.  You can put it wherever you want on the system,
just remember the path name so you can configure it properly.


* For AmiTCP:

Edit your amitcp:db/identd and type:

arws	stream	tcp dos bin - rx webserver.rexx

Edit your amitcp:db/services and type:

http 		80/tcp		http

* For Miami:

Open Miami, select database and then select "Identd".

Add the entry:

arws stream tcp dos bin - rx webserver.rexx

Select "Services", and type the following:

http 80 tcp


CONFIGURING:

Simply pull it up in a text editor, change the path="amitcp:www" to
whatever you have your pages, or simply store them in amitcp:www since
it does make sense.  You can change whatever you want below, but be sure
you know what you are doing.  I always keep a backup copy of it before I
start doing something totaly weird, because most of the time I will screw
up and be totaly lost :-)  

One small note you should consider in changing the path.
*NEVER* put a '/' after the directory (you can have a :).  This will
cause problems.


CGI-BIN OPERATION:

The cgi-bin is simply a way to execute other ARexx scripts.  When a *.cgi
file is requested via http, and the cgi exists in the cgi-bin, the web
server will spawn the script.

The cgi-bin also has a function which allows special tags to be placed in
the HTML file, allowing an arexx command to execute at that very line.
After the program completes, the HTML file continues to print.

I have included DFD's CGI script he wrote as an example of what can be
done with this.

Please note that when creating an imbeded CGI tag, keep it on a line by
it's self.  The parsing routine will not pick out any other imbeded tags
on the same line.  However, text or HTML tags will show up just as normal.


CGI INFORMATION:

There are two ways of executing a CGI script.  The first is embeded, the 
second is stand alone.  With embeded CGI scripts, only the agruments in
the embeded CGI script tag are given to the CGI script via CLI arguments.

Example of an embeded CGI script tag:



where script.cgi is the CGI script name, and args represent the arguements
given to the CGI script.

With stand alone CGI scripts, the web server passes the entire requested
URL  to the CGI script in CLI arguments.  


CGI DEMO SCRIPTS:

counter.cgi -

This script is a counter.  The arguments are data+opt.

The data field is the name of the counter you wish to update and display.

The opt field can be blank, but if specified as a "1", it will place 
either "st", "nd", "rd", and "th" after the number depending on the number
value.

Before you intergrate counter.cgi into your html's, make sure you change
the path set inside the counter.cgi file where it states path="".


system-status.cgi -

This script simply displays your current amiga's system status.  It is
automatically formated with the 
 tag and does not require any paths,
configuration, or arguments.


gadget.cgi  -

This CGI script uses my internet gadget hardware interface to control a 
light.  By executing this script, it toggles the status of the light.  This
script also displays in HTML the current light status.  It requires no
paths, configuration, or arguments.  un-commenting a section allows the
CGI script to display status via Internet Relay Chat, using the client AmIRC.
It does require proper hardware and support software.  I am releasing this
as a teaser to spark up interest.  If there is interest, I am thinking
about releasing some sort of kit or software package which allows people
to control such internet gadgets, not just limited to lights ;-)  Also,
this script displays the current light level, one of the many other
internet gadgets that I experiment with.  You can view these in action at
http://wot.dyn.ml.org.  For those attending the AmiWest show in 1998, or
if I teach any other Internet Gadget/Webcam seminars in the future, this
will be one of the main subjects.


CONTACTING:

If you like this program, please give me an EMail.  I would love to hear
from you!  Also, if you made any neat little changes to the server program
(IE: search engine, web game, etc), please send what you have.  

You may contact me in the following ways:

My computer setup as an internet server:

http://wot.dyn.ml.org

EMail:

cmdo@gte.net

Snail-Mail:

Casey Halverson
1517 105th Ave Ct E
Puyallup, WA 98372

ATTN: RexxWebServer


THANKS:

... to Alan Lewis for noticing a little mistake made in the mime handling :-)

... to all those who have found a use for ARWS and run this on their current
system.